home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / ingres04.lzh / source / libq / IIresync.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-18  |  1.2 KB  |  67 lines

  1. # include    <ingres.h>
  2. # include    "IIglobals.h"
  3. # include    <signal.h>
  4. # include    <stdlib.h>
  5. # include    <sccs.h>
  6.  
  7. SCCSID(@(#)IIresync.c    8.1    12/31/84)
  8.  
  9.  
  10. /*
  11. **  RESYNCHRONIZE PIPES AFTER AN INTERRUPT
  12. **
  13. **    The pipes are all cleared out.  This routines must be called
  14. **    by all processes in the system simultaneously.  It should be
  15. **    called from the interrupt catching routine.
  16. */
  17.  
  18. int    IISyncs[CM_MAXPROC];
  19. void    (*IIinterrupt)() =    exit;
  20.  
  21. void
  22. IIresync()
  23. {
  24.     register int    i;
  25.     pb_t        pb;
  26.     register int    stat;
  27.  
  28.     signal(SIGINT,SIG_IGN);
  29.  
  30.     /*
  31.     **  Send SYNC blocks to all processes that are adjacent
  32.     **    in the write direction.
  33.     **  Arrange to ignore blocks from all processes that
  34.     **    are adjacent in the read direction.
  35.     */
  36.  
  37.     IIpb_prime(&pb, PB_SYNC);
  38.     for (i = 0; i < CM_MAXPROC; i++)
  39.     {
  40.         IISyncs[i]++;
  41.  
  42.         /* send SYNC to parser */
  43.         pb.pb_proc = 1;
  44.         IIpb_write(&pb);
  45.     }
  46.  
  47.     /* ovqp buffer flush is done in IIsetup() */
  48.  
  49.     /* Get out of a retrieve and clear errors */
  50.     IIin_retrieve = 0;
  51.     IIerrflag = 0;
  52.     IIndomains = IIdomains = 0;
  53.     IInewqry = 0;
  54.  
  55.  
  56.     /* reset the signal */
  57.     signal(SIGINT, IIresync);
  58.     /* allow the user to service the interrupt */
  59.     (*IIinterrupt)(-1);
  60.     /*
  61.     ** If IIinterupt returns the user might hang in a retrieve
  62.     */
  63.  
  64.     IIsyserr("Interupt returned");
  65. }
  66.  
  67.